﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Admin72H.Controls.Login
{
    public partial class UCLogin : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //error.Visible = false;
            //if (CommonWeb.CheckLogin() == true)
            //{
            //    Response.Redirect("~/Default.aspx");
            //}            
        }
        /*#region Click
        protected void login_OnClick(object sender, EventArgs e)
        {
            bool login = doLogin(name.Text, password.Text);
            if (CommonWeb.CheckLogin() == true)
            {
                Response.Redirect("~/Default.aspx");
            } 
        }
        protected bool doLogin(string username, string password)
        {
            if (username == string.Empty)
            {
                error.Visible = true;
                RadAjaxManager1.ResponseScripts.Add(string.Format(@"radalert('{0}', 280, 120,'72H Administrator');", "Vui lòng nhập Username!"));
                error.Text = @"<span style='color:red'></span>";
                return false;
            }
            if (password == string.Empty)
            {
                error.Visible = true;
                RadAjaxManager1.ResponseScripts.Add(string.Format(@"radalert('{0}', 280, 120,'72H Administrator');", "Vui lòng nhập Password!"));
                error.Text = @"<span style='color:red'></span>";
                return false;
            }

            try
            {
                int result = CommonWeb.Login(username, password);
                if (result == 0)
                    return true;
                else
                    return false;
            }
            catch (Exception e1)
            {
                return false;
            }
        }  
        #endregion*/
    }    
    
}